package edu.mse.camel.client.whiteboard.gef.ui.editor;

import org.eclipse.gef.GraphicalViewer;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;

import edu.mse.camel.client.whiteboard.gef.ui.WhiteboardPlugin;

public class SaveImageAction extends Action {

	/**
	 * Constructor for Action1.
	 */
	public SaveImageAction(GraphicalViewer viewer) {
		super(LABEL, WhiteboardPlugin.getImageDescriptor("icons/whiteboard.gif"));
		setId(ID);
		this.viewer = viewer;
	}

	public static final String ID = "edu.mse.camel.client.whiteboard.gef.ui.editor.saveImageAction";

	public static final String LABEL = "Save Image";

	private GraphicalViewer viewer;

	public void run() {
		IEditorPart editorPart = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		ImageSaveUtil.save(editorPart, viewer);
	}
}
